package com.fruit.alipay.util;

import com.alipay.api.domain.AlipayTradeOrderMobilepayModel;
import com.alipay.api.internal.util.json.JSONWriter;
import com.alipay.api.request.AlipayTradeAppPayRequest;

/**
 * 
 * @ClassName: AlipayAppRequestBuilder
 * @author 葛欢欢
 * @version 2017.11.30 16:40
 */
public class AlipayAppRequestBuilder {
	private AlipayTradeOrderMobilepayModel model = new AlipayTradeOrderMobilepayModel();
	private AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @return AlipayTradeOrderMobilepayModel
	 */
	public AlipayTradeOrderMobilepayModel getModel() {
		return model;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param mo mo
	 */ 
	public void setModel(AlipayTradeOrderMobilepayModel mo) {
		this.model = mo;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @return AlipayTradeAppPayRequest
	 */
	public AlipayTradeAppPayRequest getRequest() {
		request.setBizContent(new JSONWriter().write(model, true));
		return request;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param req req
	 */
	public void setRequest(AlipayTradeAppPayRequest req) {
		this.request = req;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param returnUrl returnUrl
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setReturnUrl(String returnUrl) {
		request.setReturnUrl(returnUrl);
		return this;
	}

	/**
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param notifyUrl notifyUrl
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setNotifyUrl(String notifyUrl) {
		request.setNotifyUrl(notifyUrl);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param outTradeNo outTradeNo
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setOutTradeNo(String outTradeNo) {
		model.setOutTradeNo(outTradeNo);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param totalAmount totalAmount
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setTotalAmount(String totalAmount) {
		model.setTotalAmount(totalAmount);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param subject subject
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setSubject(String subject) {
		model.setSubject(subject);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param body body
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setBody(String body) {
		model.setBody(body);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param sellerId sellerId
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setSellerId(String sellerId) {
		model.setSellerId(sellerId);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param timeoutExpress timeoutExpress
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setTimeoutExpress(String timeoutExpress) {
		model.setTimeoutExpress(timeoutExpress);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param authToken authToken
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setAuthToken(String authToken) {
		model.setAuthToken(authToken);
		return this;
	}

	/**
	 * 
	* @author 葛欢欢
	* @version 2017.11.30 16:40
	* @param productCode productCode
	* @return AlipayAppRequestBuilder
	 */
	public AlipayAppRequestBuilder setProductCode(String productCode) {
		model.setProductCode(productCode);
		return this;
	}
}
